package TFIDF;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * 接收<肖申克的救赎_希望,TF>
 * 输出<肖申克的救赎_希望,1>
 */
public class MapTest02 extends Mapper<LongWritable, Text, Text, IntWritable> {
    IntWritable v = new IntWritable(1);
    Text k = new Text();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String[] datas = value.toString().split("\t");
        k.set(datas[0]);
        context.write(k, v);
    }
}
